<?php
namespace app\admin\command;

use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\Output;
use think\Exception;
use think\Log;

/**
 * DbPatch 命令 php think DbPatch
 * Class DbPatch
 * @package app\admin\command
 */
class DbPatch extends Command
{
    protected function configure()
    {
        //设置名称为DbPatch
        $this->setName('DbPatch');
    }

    protected function execute(Input $input, Output $output)
    {

        set_time_limit(0);
        $output->info('DbPatch patching...');

        $result = false;
        $msg = 'DbPatch execute Success! Not Update Data';
        try {
            $obj = new \DBPatch\DBPatchMall();
            $result = $obj->patching();
        }catch (Exception $e){
            $msg .= $e->getMessage();
        }

        if ($result){
            $msg = 'DbPatch execute Success!';
        }

        $output->info($msg);
    }
}